/**
 * 给定若干个字符串，问互异的有多少个。
 * 注意reverse相等的也算相等。
 * 对每个原字符串和reverse，只计算字典序小的哈希即可
 * 字符串哈希
 * 标程直接用set<string>。
 */
#include <bits/stdc++.h>
using namespace std;

namespace ZIFUCHUAN
{

int const UN = 2;

using hash_t = array<size_t, UN>;
// 10007, 10093
hash_t const Seeds {13313, 10}; // 10用来观察效果
hash_t const ZERO {0, 0};
hash_t const ONE {1, 1};

hash_t const operator + (const hash_t & a, const hash_t & b){
    hash_t ans;
    for(int i=0;i<UN;++i) ans[i] = a[i] + b[i];
    return ans;
}

hash_t const operator - (const hash_t & a, const hash_t & b){
    hash_t ans;
    for(int i=0;i<UN;++i) ans[i] = a[i] - b[i];
    return ans;
}

hash_t const operator * (const hash_t & a, const hash_t & b){
    hash_t ans;
    for(int i=0;i<UN;++i) ans[i] = a[i] * b[i];
    return ans;
}

ostream & operator << (ostream & os, const hash_t & h) {
    os << "[";
    for(int i=0;i<UN;++i){
        os << h[i];
        if(i + 1 == UN) os << "]";
        os << ",";
    }
    return os;
}

vector<hash_t> Power; // 进制的幂值
void initPower(int n){
    Power.clear();
    Power.reserve(n + 1);
    Power.emplace_back(ONE);

    for(int i=1;i<=n;++i){
        Power.emplace_back(Power.back() * Seeds);
    }

    return;
}

hash_t tr(char c) {
    hash_t ans;
    for(int i=0;i<UN;++i) {
        // ans[i] = c;
        ans[i] = c - 'a' + 1;
    }
    return ans;
}

template<typename IT = string::const_iterator>
struct StrHash
{

/// 
StrHash(IT begin, int n):N(n){
    H.clear();
    H.reserve(N + 1);
    H.emplace_back(ZERO);
    for(int i=1;i<=N;++i){
        H[i] = H[i - 1] * Seeds + tr(*begin++);
    }
    return;
}

/// s[a...b]的哈希, a和b是0-index
hash_t get(int a, int b) const {
    assert(0 <= a and a <= b and b < N);
    // ++a, ++ b;
    // return H[b] - H[a - 1] * Power[b - a + 1];
    return H[b + 1] - H[a] * Power[b - a + 1];
}

vector<hash_t> H;
int N;

};


}

/// 模板偏特化
template<> struct std::hash<ZIFUCHUAN::hash_t> {
    std::size_t operator() (const ZIFUCHUAN::hash_t & p) const {
        std::size_t ret = 0;
        for(auto i : p) ret = ret * 9973 + i;
        return ret;
    }
};

using namespace ZIFUCHUAN;

int N;
string S;
string T;
unordered_set<hash_t> Set;

void work(){
    initPower(2E5 + 1100);

    cin >> N;
    for(int i=0;i<N;++i){
        cin >> S;
        int n = S.length();
        T = S;
        reverse(T.begin(), T.end());
        if(S < T){
            Set.insert(StrHash<>(S.begin(), n).get(0, n - 1));
        }else{
            Set.insert(StrHash<>(T.begin(), n).get(0, n - 1));
        }
    }

    cout << Set.size() << endl;
    return;
}

int main(){
#ifndef ONLINE_JUDGE
    freopen("z.txt", "r", stdin);
#endif
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    int nofkase = 1;
    // cin >> nofkase;
    while(nofkase--) work();
    return 0;
}